<?php
function getSubNavs($mainCat, $mainGall)
{
	$tables = array();
	$tables[0] = 'extras_subnavigation';
	
	$fields = array();
	$fields[0] = 'name';
	$fields[1] = 'href';
	
	$whereClause = 'category="'.$mainCat.'" ORDER BY `order` ASC';
	
	$data = SQLRecover($tables, $fields, $whereClause);
	
	$last = sizeOf($data['name']) - 1;
	$return['main'] = '';
	$return['mainz'] = '';
	$return['galleries'] = '';
	
	for ($i=0; $i<sizeOf($data['name']); $i++)
	{
		$return['main'] .= '<a href="'.INDEX.'catalogue'.EXT.'category='.$mainCat.'&gallery='.$data['href'][$i].'" class="subnavLink'.($i == $last ? ' last' : '').'">'.$data['name'][$i].'</a>
			';
			
		$return['mainz'] .= '<a href="'.INDEX.'catalogue'.EXT.'category='.$mainCat.'&gallery='.$data['href'][$i].'" class="subnavLinkx'.($i == $last ? ' last' : '').'">'.$data['name'][$i].'</a>
			';
			
		$return['galleries'] .= '
				<li>-&nbsp;&nbsp;&nbsp;<a href="'.INDEX.'catalogue'.EXT.'category='.$mainCat.'&gallery='.$data['href'][$i].'">'.$data['name'][$i].'</a></li>
			';
		
	}
	return $return[$mainGall];
}

function getSubNavName($subnavhref)
{
	$tables = array();
	$tables[0] = 'extras_subnavigation';
	
	$fields = array();
	$fields[0] = 'name';
	
	$whereClause = 'href="'.$subnavhref.'"';
	
	$data = SQLRecover($tables, $fields, $whereClause);

	return $data['name'][0];
}

?>